package com.authority.framework.web.service.impl;

import com.authority.framework.base.service.impl.BaseServiceImpl;
import com.authority.framework.web.domain.SysUserEntity;
import com.authority.framework.web.service.SysUserService;
import org.beetl.sql.core.SQLManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.Map;

/**
 * @program: authority
 * @description: 用户 impl层
 * @author: Mr.Yan
 * @create: 2018-11-15 13:47
 **/
@Service
@Transactional
public class SysUserServiceImpl extends BaseServiceImpl<SysUserEntity> implements SysUserService {
	@Autowired
	private SQLManager sqlManager;

	private Map<String, String> paramMap = null;

	/**
	 * 删除用户以前的角色
	 * @param userId
	 * @return
	 */
	@Override
	public Integer deleteUserRole(String userId) {
		paramMap = new HashMap<>();
		paramMap.put("userId",userId.toString());
		return  sqlManager.update("system/SysUserRole.deleteUserRole",paramMap);
	}

	/**
	 * 删除用户以前的岗位
	 * @param userId
	 * @return
	 */
	@Override
	public Integer deleteUserPost(String userId) {
		paramMap = new HashMap<>();
		paramMap.put("userId",userId.toString());
		return 	sqlManager.update("system/SysUserPost.deleteUserPost",paramMap);
	}
}
